package org.test;

import java.io.IOException;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws IOException {

        OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "{\"customer\":\"tngt-bms-prod\",\"lang\":\"zh\"}");
        Request request = new Request.Builder()
            .url("https://ttbms.loghub.com/api/fa/audit/fail/401011/c62de54a-3f3e-4709-bdd4-ae5a6f5384bc")
            .method("POST", body)
            .addHeader("x-cbtVersion", " 2.7.0")
            .addHeader("X-CLIENT", " f6d29d67001e4314b12ff94c8144d4d6")
            .addHeader("X-DB", " tngt-bms-prod")
            .addHeader("x-device", " browser")
            .addHeader("X-Locale", " zh")
            .addHeader("x-params", " {\"user\":\"admin\"}")
            .addHeader("X-Range", " items=0-99")
            .addHeader("X-Requested-With", " XMLHttpRequest")
            .addHeader("X-Result-Fields", " id,code,name,warehouseCode,type,ignoreMixedLoad")
            .addHeader("X-Token", " 03770c0e57754360bc5b92b0ba896acf")
            .addHeader("X-User", " admin")
            .addHeader("Content-Type", "application/json")
            .build();
        Response response = client.newCall(request).execute();
        System.out.println("resp:"+response.body().string());
    }
}
